import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';

@Component({
  selector: 'app-dialog',
  templateUrl: './dialog.component.html',
  styleUrls: ['./dialog.component.css']
})
export class DialogComponent implements OnInit {
  @Input() tag: any;
  @Input() value: string;
  @Input() valueReadonly: boolean;
  @Input() showPrompt: boolean;
  @Input() placeholder: string;
  @Input() title: string;
  @Input() template: string;
  @Input() okText: string;
  @Input() cancelText: string;
  @Output() valueEmitted = new EventEmitter<string>();
  @Output() visible = new EventEmitter<boolean>();

  constructor() {
    this.valueReadonly = false;
    this.tag = null;
    this.okText = 'OK';
    this.cancelText = 'Cancel';
  }
  closeDialog() {
    this.showPrompt = false;
    this.visible.emit(this.showPrompt);
  }
  emitValue(value) {
    this.valueEmitted.emit(value);
  }

  ngOnInit() {
  }
}
